package com.zq.assistant.mgr.path;

import java.io.File;

/**
 * Created by zhangqiang on 17-6-15.
 */

public abstract class BasePathManager {

    public abstract File getBaseDir();

    public  File getImageDir() {

        return makeDirIfNeed(new File(getBaseDir() , "image"));
    }

    /**
     * 获取视频文件保存位置
     *
     * @return
     */
    public  File getVideoDir() {

        return makeDirIfNeed(new File(getBaseDir() , "video"));
    }

    /**
     * 获取http请求缓存目录
     *
     * @return
     */
    public  File getHttpCacheDir() {

        return makeDirIfNeed(new File(getCacheDir() , "http"));
    }

    public abstract File getCacheDir();

    /**
     * 获取webView缓存目录
     *
     * @return
     */
    public  File getWebViewCacheDir() {

        return makeDirIfNeed(new File(getCacheDir() , "webView"));
    }

    /**
     * 获取图片缓存目录
     *
     * @return
     */
    public  File getImageCacheDir() {

        return makeDirIfNeed(new File(getCacheDir() , "webView"));
    }

    protected static File makeDirIfNeed(File file){

        if(!file.exists()){
            file.mkdir();
        }
        return file;
    }
}
